﻿using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Web.Security;

namespace WpfMembershipAdmin
{
    internal static class MembershipUserCreateStatusExtensions
    {
        internal static String GetUIDescription(this MembershipCreateStatus status)
        {
            String message = "Unknown Error";

            switch (status) {
                case MembershipCreateStatus.Success:
                    message = "The user was successfully created";
                    break;
                case MembershipCreateStatus.InvalidUserName:
                    message = "The user name was not found in the database";
                    break;
                case MembershipCreateStatus.InvalidPassword:
                    message = "The password is not formatted correctly";
                    break;
                case MembershipCreateStatus.InvalidQuestion:
                    message = "The password question is not formatted correctly";
                    break;
                case MembershipCreateStatus.InvalidAnswer:
                    message = "The password answer is not formatted correctly";
                    break;
                case MembershipCreateStatus.InvalidEmail:
                    message = "The e-mail address is not formatted correctly";
                    break;
                case MembershipCreateStatus.DuplicateUserName:
                    message = "The user name already exists in the database for the application";
                    break;
                case MembershipCreateStatus.DuplicateEmail:
                    message = "The e-mail address already exists in the database for the application";
                    break;
                case MembershipCreateStatus.UserRejected:
                    message = "The user was not created, for a reason defined by the provider";
                    break;
                case MembershipCreateStatus.InvalidProviderUserKey:
                    message = "The provider user key is of an invalid type or format";
                    break;
                case MembershipCreateStatus.DuplicateProviderUserKey:
                    message = "The provider user key already exists in the database for the application";
                    break;
                
                case MembershipCreateStatus.ProviderError:
                    message = "The provider returned an error that is not described by other System.Web.Security.MembershipCreateStatus enumeration values";
                    break;
            }

            return message;
        }
    }
}
